home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 November / EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso / earcd / program / misc / gencodee.lha / E / sources / GenCodeE.e < prev    next >
Text File  |  1995-09-12  |  4KB  |  133 lines

  1. OPT OSVERSION=37
  2. OPT PREPROCESS
  3.  
  4.  
  5. ->/////////////////////////////////////////////////////////////////////////////
  6. ->//////////////////////////////////////////////////////////// MODULE ... /////
  7. ->/////////////////////////////////////////////////////////////////////////////
  8. MODULE 'muibuilder' , 'libraries/muibuilder'
  9. MODULE 'utility/tagitem'
  10.  
  11. MODULE '*MUIStrings'
  12. MODULE '*AuxProcs'
  13. MODULE '*Variable'
  14. MODULE '*GUIFile'
  15.  
  16.  
  17. ->/////////////////////////////////////////////////////////////////////////////
  18. ->//////////////////////////////////////////////// RAISE ... IF ... = ... /////
  19. ->/////////////////////////////////////////////////////////////////////////////
  20. RAISE    "LIB"    IF    OpenLibrary()    =    NIL    ,
  21.         "MBtf"    IF    Mb_Open()        =    NIL    ,
  22.         "MEM"    IF    String()        =    NIL
  23.  
  24.  
  25. ->/////////////////////////////////////////////////////////////////////////////
  26. ->///////////////////////////////////////////////////////////// PROC main /////
  27. ->/////////////////////////////////////////////////////////////////////////////
  28. PROC main() HANDLE
  29.  
  30.     DEF application = FALSE , declarations = FALSE , code = FALSE
  31.     DEF notifications = FALSE , environment = FALSE , locale = FALSE
  32.     DEF filename : PTR TO CHAR , catalog_filename : PTR TO CHAR
  33.     DEF catalog_name : PTR TO CHAR , getstring_func : PTR TO CHAR
  34.     DEF number_vars , vars : PTR TO variable , ident_length_max
  35.     DEF genfile = NIL : PTR TO gui_file
  36.     DEF tmp_string : PTR TO CHAR
  37.  
  38.     muibbase := OpenLibrary( 'muibuilder.library' , 0 )
  39.     Mb_Open()
  40.  
  41.     Mb_GetA( [    MUIB_VARNUMBER        , {number_vars}            ,
  42.                 MUIB_APPLICATION    , {application}            ,
  43.                 MUIB_DECLARATIONS    , {declarations}        ,
  44.                 MUIB_CODE            , {code}                ,
  45.                 MUIB_NOTIFICATIONS    , {notifications}        ,
  46.                 MUIB_ENVIRONMENT    , {environment}            ,
  47.                 MUIB_LOCALE            , {locale}                ,
  48.                 MUIB_FILENAME        , {filename}            ,
  49.                 MUIB_CATALOGNAME    , {catalog_filename}    ,
  50.                 MUIB_GETSTRINGNAME    , {getstring_func}        ,
  51.                 TAG_END ] )
  52.  
  53.     tmp_string := filename
  54.     filename := String( StrLen( filename ) + 2 )
  55.     StringF( filename , '\s.e' , tmp_string )
  56.  
  57.     catalog_filename := FilePart( catalog_filename )
  58.     catalog_name := String( StrLen( catalog_filename ) + 5 )
  59.     StringF( catalog_name , 'catalog_\s' , catalog_filename )
  60.  
  61.     vars , ident_length_max := init_variables( number_vars )
  62.  
  63.     NEW genfile.open( filename , number_vars , vars , ident_length_max )
  64.  
  65.     IF declarations
  66.  
  67.         IF environment THEN genfile.put_header( application , locale )
  68.         genfile.put_aux_objects( environment , application )
  69.         genfile.put_main_object( environment )
  70.         genfile.put_constants( environment )
  71.         genfile.put_global_vars( environment , locale , catalog_name )
  72.  
  73.     ENDIF
  74.  
  75.     IF code
  76.  
  77.         IF environment THEN genfile.put_create_declaration( application )
  78.         IF environment THEN genfile.put_create_local_defs()
  79.         IF environment THEN genfile.put_create_initialisations( locale , getstring_func )
  80.         genfile.put_code( getstring_func , muistrings_contents() )
  81.         IF environment THEN genfile.put_create_end()
  82.         IF environment THEN genfile.put_dispose_method()
  83.  
  84.     ENDIF
  85.  
  86.     IF notifications
  87.  
  88.         IF environment THEN genfile.put_init_notifications_declaration()
  89.         genfile.put_notifications( muistrings_contents() , getstring_func )
  90.         IF environment THEN genfile.put_init_notifications_end()
  91.  
  92.     ENDIF
  93.  
  94.     IF environment AND locale THEN genfile.put_aux_funcs()
  95.  
  96. EXCEPT DO
  97.  
  98.     SELECT exception
  99.  
  100.         CASE "MEM"
  101.  
  102.             error_request( 'Out of memory !' )
  103.  
  104.         CASE "LIB"
  105.  
  106.             error_request( 'Can''t open muibuilder.library !' )
  107.  
  108.         CASE "MBtf"
  109.  
  110.             error_request( 'Unable to get temporary files !' )
  111.  
  112.         CASE "OPEN"
  113.  
  114.             error_request( 'Unable to open file to generate !' )
  115.  
  116.         CASE "OUT"
  117.  
  118.             error_request( 'Trouble writing file to generate !' )
  119.  
  120.     ENDSELECT
  121.  
  122.     IF genfile    THEN genfile.close()
  123.     IF muibbase    THEN Mb_Close()
  124.     IF muibbase    THEN CloseLibrary( muibbase )
  125.  
  126. ENDPROC
  127.  
  128.  
  129. ->/////////////////////////////////////////////////////////////////////////////
  130. ->//////////////////////////////////////////////////////// Version string /////
  131. ->/////////////////////////////////////////////////////////////////////////////
  132. CHAR '$VER: GenCodeE 2.4 (12.9.95)' , 0
  133.